home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
macros
/
latex209
/
contrib
/
letters
/
finder
/
finder.sty
< prev
next >
Wrap
Text File
|
1992-02-25
|
6KB
|
226 lines
% DOCUMENT OPTION STYLE
%
% This style has to be used as an optional style.
%
% Copyright (c) 1991,1992 by Steffen Steinhaeuser
% Permission to copy all or part of this work is granted, provided
% that the copies are not made or distributed for resale, and that
% the copyright notice and this notice are retained.
%
% THIS WORK IS PROVIDED ON AN "AS IS" BASIS. THE AUTHOR PROVIDES NO
% WARRANTY WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE WORK,
% INCLUDING WARRANTIES WITH RESPECT TO ITS MERCHANTABILITY OR FITNESS
% FOR ANY PARTICULAR PURPOSE.
%
% If you make any improvements, I'd like to hear about them.
%
% Steffen Steinh\"auser
% Landwehrstr. 47
% 6100 Darmstadt
% Federal Republic of Germany
% steinhaeuser@ddagsi5.bitnet
% steffen_steinhaeuser@mz.maus.de
%
\def~{ }
\typeout{-------------------------------------------------------}
\typeout{| FINDER.STY V2.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|}
\typeout{| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c'91 stone |}
\typeout{-------------------------------------------------------}
\newif\ifstillmore
\newif\iffoundname
\newif\iffoundfirstname
\newif\iffoundsecondname
\newif\iffindnameokay
\findnameokayfalse
\newif\ifserienbrief
\serienbrieffalse
\newread\datafile
\gdef\firstname{???\message{Kein 1.Suchwort definiert!}}
\gdef\secondname{???\message{Kein 2. Suchwort definiert!}}
\def\meldung#1{
\typeout{}
\typeout{#1}
\typeout{}}
\def\serienbrief#1{\long\def\serientext{#1}
\meldung{Der Text des Serienbriefes wurde abgespeichert.}
\serienbrieftrue
\findnameokayfalse
\foundnamefalse}
\def\findname{\DblArg{\findn@me}}
\def\DblArg #1{\def\DAtemp{#1}\futurelet\DALook\Decide }
\def\Decide{\ifx \DALook [ \let\DAdo=\DAtemp
\else \let\DAdo=\DBarg \fi \DAdo }
\def\DBarg #1{\DAtemp[#1]{#1}}
\long\def\findn@me[#1]#2{ %
\gdef\firstname{#1}
\gdef\secondname{#2}
\serienbrieffalse
\ifx\firstname\@empty
\ifx\firstname\secondname
\meldung{Es wurden keine Suchdaten uebergeben !!!}
\findnameokayfalse
\else
\findnameokaytrue
\foundnamefalse
\global\edef\firstname{\secondname}
\fi
\else
\ifx\secondname\@empty
\global\edef\secondname{\firstname}
\findnameokaytrue
\else
\findnameokaytrue
\foundnamefalse
\fi
\fi}
\def\lookat#1 #2@@@{\gdef\found{#1}\gdef\rest{#2}
\iffoundfirstname\else
\ifx\found\firstname
\foundfirstnametrue
\else
\foundfirstnamefalse
\fi
\fi
\iffoundsecondname\else
\ifx\found\secondname
\foundsecondnametrue
\else
\foundsecondnamefalse
\fi
\fi
\iffoundfirstname
\iffoundsecondname
\foundnametrue
\else
\ifx\rest\@empty\else
\expandafter\lookat\rest @@@
\fi
\fi
\else
\ifx\rest\@empty\else
\expandafter\lookat\rest @@@
\fi
\fi}
\def\addressfile#1{\gdef\filename{#1}
\iffoundname
\meldung{Datei \filename~ wird nicht durchsucht !!!}
\else
\foundnamefalse
\analysefile
\ifserienbrief
\foundnamefalse
\fi
\fi}
\long\def\analysefile{ %
\immediate\openin\datafile = \filename
\iffindnameokay
\stillmoretrue
\else
\ifserienbrief
\stillmoretrue
\foundnametrue
\else
\meldung{\string\findname{...}~ vor \string\addressfile~ aufrufen !!!}
\stillmorefalse
\fi
\fi
\message{finder.sty is searching in \filename}
\loop
\message{.}
\foundfirstnamefalse
\foundsecondnamefalse
\ifeof\datafile\relax\else
\immediate\read\datafile to \lineone
\fi
\ifeof\datafile\stillmorefalse\else
\gdef\name{\lineone}
\iffoundname\else
\if\endgraf\lineone
\gdef\name{\message{\string\name~ nicht definiert !!!}}
\else
\expandafter\lookat\lineone @@@
\fi
\fi
\fi
\ifeof\datafile\relax\else\immediate\read\datafile to \linetwo \fi
\ifeof\datafile\stillmorefalse\else
\gdef\street{\linetwo}
\iffoundname\else
\if\endgraf\linetwo
\gdef\street{\message{\string\street~ nicht definiert !!!}}
\else
\expandafter\lookat\linetwo @@@
\fi
\fi
\fi
\ifeof\datafile\relax\else\immediate\read\datafile to \linethree \fi
\ifeof\datafile\stillmorefalse\else
\gdef\city{\linethree}
\iffoundname\else
\if\endgraf\linethree
\gdef\city{\message{\string\city~ nicht definiert !!!}}
\else
\expandafter\lookat\linethree @@@
\fi
\fi
\fi
\ifeof\datafile\relax\else\immediate\read\datafile to \linefour \fi
\ifeof\datafile\stillmorefalse\else
\gdef\telephone{\linefour}
\iffoundname\else
\if\endgraf\linefour
\gdef\telephone{\message{\string\telephone~ nicht definiert !!!}}
\else
\expandafter\lookat\linefour @@@
\fi
\fi
\fi
\ifeof\datafile\relax\else\immediate\read\datafile to \linefive \fi
\ifserienbrief
\ifstillmore
\typeout{Adresse -> Serienbrief : \name}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \street}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \city}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \telephone}
\serientext
\else
\gdef\name{}
\gdef\street{}
\gdef\city{}
\gdef\telephone{}
\fi
\else
\iffoundname
\stillmorefalse
\typeout{Adresse gefunden: ~~~~~~ \name}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \street}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \city}
\typeout{~~~~~~~~~~~~~~~~~~~~~~~~ \telephone}
\fi
\fi
\ifstillmore\else
\iffoundname\else
\foundnamefalse
\meldung{Datensatz nicht gefunden!!!}
\gdef\name{}
\gdef\street{}
\gdef\city{}
\gdef\telephone{}
\fi
\fi
\ifstillmore
\repeat
\closein\datafile}